import csv
with open("data2.csv",mode="a",encoding="utf-8",newline="") as f:
    csv_writer = csv.writer(f)
    if f.tell() == 0:
        csv_writer.writerow(["姓名","年龄","城市"])
    csv_writer.writerow(["张三", "20", "北京"])
    csv_writer.writerows([["王五", "21", "郑州"], ["马六", "22", "上海"]])
    